
import { DefaultLayout, GraphNode } from "@/js/components/GraphNode"
import { GraphView } from "@/js/components/GraphView"
import { InputLinkNodeAny, InputLinkNodeBoolean, InputLinkNodeFlow } from "@/js/components/InputLinkNode"

export class Return extends GraphNode{
    layout?: DefaultLayout
    load(){
        super.load()

        const layout = new this.DefaultLayout(this, this.graphView as GraphView, true, false)
        this.layout = layout
        this.appendChild(layout.container)

        const booleanEntry = new InputLinkNodeAny(this, this.graphView as GraphView, {
            name: "return",
            desc: '返回值',
            model: "entry",
        })

        layout.main?.left.appendChild(booleanEntry)
    }
}

Return.parser = ({node,toNode}: any) => {
    return "return " + toNode(node.enters.return[0], 'output')
}